<?php

namespace App\Api\Controller;

use App\Activity;
use Dingo\Api\Routing\Helpers;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Request;

class ActivityController extends Controller{
    use Helpers;
    public function index()
    {
        return Activity::all();
    }

    public function show(Request $request,$id)
    {
        $activity=Activity::where('id',$id)->get();
        if ($activity->isEmpty())
        {
            return $this->response->errorBadRequest('没有找到此活动');
        }else{
            return $this->response->array($activity->toArray());
        }
    }
}